<template>
  <el-card class="admin-header">
    <span style="font-size: 32px;font-weight: bold;position:absolute;left: 100px">智  网</span>
    <i class="el-icon-switch-button" v-on:click="logout" style="font-size: 40px;float: right"></i>
  </el-card>
</template>

<script>

export default {
  name: 'Header',
  methods: {
    logout() {
      this.$axios.get('/user/logout').then(res => {
        if (res.data.data === 1) {
          this.$store.commit('clear')
          this.$router.replace('/login')
        } else {
          this.$message.error('注销失败')
        }
      })
    }
  }
}
</script>

<style scoped>
.admin-header {
  height: 80px;
  opacity: 0.85;
  line-height: 40px;
  min-width: 900px;
}
.el-icon-switch-button {
  cursor: pointer;
  outline:0;
}
</style>
